<!-- 
	게시판
 -->
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>
<%@ page import="model.*" %>
<%
	String listName = "boardList";
	ArrayList<Board> boardList = new ArrayList<Board>();
	if(request.getAttribute("boardList") != null)
		boardList = (ArrayList<Board>)request.getAttribute(listName);
	int studyId = ((Integer)request.getAttribute("studyId")).intValue();
	String checkValue =  (String)request.getAttribute("checkValue");
	if(checkValue==null){
		%>
		<script>
			location.href= "List.Board?studyId=<%=studyId %>";
		</script>
		<%
		
	}
	//else if(request.getAttribute("noticeList") != null) listName = "noticeList";
	//else if(request.getAttribute("questList") != null) listName = "questList";
%>
<script>
function showBoardContent(boardId) {
	//공지사항 컨텐츠를 보여주기 위해
}

</script>
<section>
	<div class="col-md-6 col-md-offset-3 col-lg-6 col-lg-offset-3">
		<form method="post" action="New.Board?studyId=<%=studyId%>">
			<button class="btn btn-default" type="submit">글쓰기</button>
		</form>
		<ul class="list-group">
			<%for(Board board : boardList) { %>
				<li class="list-group-item" onclick="showContent('<%=board.getBoardId()%>')">
					<div class="row">
						<div class="col-xs-4 col-md-3">
							<%=board.getTitle() %>
						</div>
						<div class="col-xs-8 col-md-9">
							<%=board.getMemid() %>
						</div>
					</div>
					<div class="" id='<%=board.getBoardId() %>' style="display:none;">
						<div class="panel-body">
							<%=board.getContent() %>
						</div>
						<% if(board.getMemid().equals(session.getAttribute("memid"))) { %>
							<button type="button" class="btn btn-default" onclick="modify('board','<%=studyId %>', '<%=board.getBoardId() %>')">수정</button>
						<% } %>
					</div>
				</li>
			<%} %>
		</ul>
	</div>
</section>